<script language="javascript" src="<?php echo base_url(); ?>application/views/farmacia/ventaFarmacia.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>media/jquery/jquery.min.js"></script>
<script type="text/javascript">
urlBaseX = "<?php echo base_url(); ?>";
</script>
<form class="form-horizontal well" method="get" action="<?php echo base_url(); ?>farmacia/insertarVenta" accept-charset="utf-8">
    <legend>REGISTRO DE VENTA</legend>
    <table class="table table-hover" >
        <tr>
            <td align="center" width="15%">Persona</td>
            <td align="center" width="15%"><?php latisoft_comboBox("tipoDocumento","", array(), 0, "Tipo doc.", true,'180',false); ?></td>
            <td align="center" align="right" width="25%"> <input type="hidden" name="hidCodPaciente"><input name="codigoPaciente" onblur="obtenerPaciente('<?php echo base_url(); ?>')" type="text" class="input-prepend" placeholder="cód. Persona"  ></td>
            <td align="center" width="45%"><input class="input-xlarge"type="text" name="nombres" disabled>  <button class="btn btn-mini  btn btn-success" type="button" onclick="buscarPersona()" STYLE="margin-bottom: 10PX;" >Buscar</button></td>
        </tr> 
        
        <tr>
            <td align="center" >Tratamiento</td>
            <td align="center" ><input onblur="obtenerProductosYPersona()" name="codigoProcedimiento"  type="text" class="input-prepend" placeholder="cód. Procedimiento"  ></td>
            <td align="center"><button class="btn btn-mini  btn btn-success" type="button" onclick="$('#myModalTratameinto').modal('show')" STYLE="margin-bottom: 10PX;" >Buscar</button></td>
        </tr> 
    </table>
        
    <legend>DETALLE DE VENTA</legend>
    <table  class="table table-hover" id="detalle" width="100%">
        <tr>
            <td  width="05%">N*</td>
            <td  width="15%">Código</td>
            <td  width="20%">Descripcion</td>
            <td  width="10%">Laboratorio</td>
            <td  width="10%">Precio</td>
            <td  width="10%">Cant.</td>
            <td  width="10%">Total</td>
            <td width="10%">Sus.</td>
        </tr>   
        <tr>
            <td >1</td>
            <td ><input type="hidden" name="hidCodProd[]"><input class="input-small" id="prod1" name="codProd[]" type="text" data-provide="typeahead"  onblur="obtenerProducto(0)" placeholder="cod. producto" ></td>
            <td ><input class="input-prepend" type="text" name="nombreProd[]" disabled></td>
            <td ><input class="input-small" type="text" name="nombreLab[]" disabled></td>
            <td ><input class="input-mini" type="text" disabled name="PrecioProd[]"></td>
            <td ><input class="input-mini" type="text" placeholder="cantidad" onblur="obtenerTotal(0,true)" name="cantidadProd[]"></td>
            <td ><input type="hidden" name="hidTotalParProd[]"><input class="input-mini" type="text" name="TotalParProd[]" disabled></td>
            <td ><button class="btn btn-mini  btn btn-success" type="button" onclick="buscarprodEqui(0)" STYLE="margin-bottom: 10PX;" >Buscar</button></td>
        </tr>
     </table>
      <table width="100%"  class="table table-hover">
        <tr>
            <td  width="05%"></td>
            <td  width="15%"></td>
            <td  width="30%"></td>
            <td  width="15%"></td>
            <td  width="15%" align="left">Precio Total</td>
            <td  align="center" width="15%"><input  type="hidden" name="hidPrecioTotal" ><input class="input-small" type="text" name="PrecioTotal" disabled ></td>
        </tr>
       
     </table>      
    
     <div class="span10">
       <p> 
           <button type="button" class="btn btn-mini btn-primary" onclick="agregarFila()" >Agregar Item</button>
       </p>
    </div>
    
    <table width="100%">
             <tr>
                    <td width="46%" align="right" ><?php latisoft_button("", "Submit","Grabar","") ?> </td>
                    <td width="8%" align="left"></td>
                    <td width="46%" align="left"><?php latisoft_button("", "Submit","Cancelar","") ?> </td>
             </tr>
    </table>

   
   
   
<div class="modal" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display:none;width:900px;">

    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true" onclick="limpiartabla('tablPac')" >×</button>
        <h3 id="myModalLabel">Productos Sustituto</h3>
    </div>
<div class="modal-body" style="height:550px;">
    
    <table id="tablProd" class="table table-hover" width="700px">
        <tr>
            <td  width="05%">N*</td>
            <td  width="15%">Código</td>
            <td  width="20%">Descripcion</td>
            <td  width="10%">Laboratorio</td>
            <td  width="10%">Precio</td>
        </tr>  
        
    </table>
    
    <div class="modal-footer">
        <button class="btn" data-dismiss="modal" aria-hidden="true" >Close</button>
    </div>
</div>


</div>   

<div class="modal"  id="myModalPersona"  tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display:none;width:900px;">

    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true" onclick="limpiartabla('tablPac')" >×</button>
        <h3 id="myModalLabel">Personas</h3>
    </div>

<div class="modal-body" style="height:550px;">
    <table id="tablBusqPer" class="table table-hover" width="700px">
        
        <tr>
            <td align="center" width="15%">Nombre</td>
            <td align="center" width="15%" colspan="3"><input type="text" class="input-xxlarge"  name="nombreBusq" /></td>
            <td align="center" align="right" width="25%"></td>
            <td align="center" width="45%"></td>
        </tr> 
       
         <tr>
            <td align="center" width="15%">Apellidos</td>
            <td align="center" width="15%" ><input type="text" class="input-large"  name="apePatBusq" /></td>
            <td align="center" align="right" width="25%"><input type="text" name="apeMatBusq" class="input-large" /></td>
        </tr> 
      
        <tr>
            <td colspan="2" align="center" width="15%"><?php latisoft_comboBox("tipoDocumentoBusq","Tipo Documento", array(), 0, "Tipo doc.", true,'180',false); ?></td>
            <td align="center" align="right" width="25%"> <input name="nroDocumentoBusq"  type="text" class="input-prepend" placeholder="cód. Persona"  >            </td>
            <td align="center" ><button class="btn btn-mini  btn btn-success" type="button" onclick="busquedaPersona()" STYLE="margin-bottom: 10PX;" >Buscar</button></td>
        </tr> 
        
        
        <table id="tablaPersona"  class="table table-hover" width="700px">
        <tr>
            <td  width="05%">N*</td>
            <td  width="20%">Nombre</td>
            <td  width="10%">Apellidos</td>
            <td  width="10%">Tipo Documento</td>
            <td  width="10%">Código</td>
        </tr>  
        
    </table>
    
        
    </table>
   
    
</div>
    
    <div class="modal-footer">
        <button class="btn" data-dismiss="modal" aria-hidden="true" >Close</button>
    </div>



</div>   


    
<div class="modal" id="myModalTratameinto" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display:none;width:900px;">

    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true" onclick="limpiartabla('tablPac')" >×</button>
        <h3 id="myModalLabel">Tratamiento</h3>
    </div>


<div class="modal-body" style="height:550px;">
    <table id="tablBusqPer" class="table table-hover" width="700px">
        
        <tr>
            <td align="center" width="15%">Nombre</td>
            <td align="center" width="15%" colspan="3"><input type="text" class="input-xxlarge"  name="nombreBusqTrata" /></td>
            <td align="center" align="right" width="25%"></td>
            <td align="center" width="45%"></td>
        </tr> 
       
         <tr>
            <td align="center" width="15%">Apellidos</td>
            <td align="center" width="15%" ><input type="text" class="input-large"  name="apePatBusqTrata" /></td>
            <td align="center" align="right" width="25%"><input type="text" name="apeMatBusqTrata" class="input-large" /></td>
        </tr> 
      
        <tr>
            <td colspan="2" align="center" width="15%"><?php latisoft_comboBox("tipoDocumentoBusqTrata","Tipo Documento", array(), 0, "Tipo doc.", true,'180',false); ?></td>
            <td align="center" align="right" width="25%"> <input name="nroDocumentoBusqTrata"  type="text" class="input-prepend" placeholder="cód. Persona"  >            </td>
            <td align="center" ><button class="btn btn-mini  btn btn-success" type="button" onclick="busquedaTratamiento()" STYLE="margin-bottom: 10PX;" >Buscar</button></td>
        </tr> 
        
        
        <table id="tablaTratamiento"  class="table table-hover" width="700px">
        <tr>
            <td  width="05%">N*</td>
            <td  width="10%">Procedimiento</td>
            <td  width="10%">Nombre</td>
            <td  width="20%">Apellidos</td>s
            <td  width="10%">Fecha</td>
        </tr>  
        
    </table>
    
        
    </table>
    
    
</div> 
    <div class="modal-footer">
        <button class="btn" data-dismiss="modal" aria-hidden="true" >Close</button>
    </div>



</div>       
    
</form>   
   